import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/home',
      name: 'Home',
      component: () => import('../views/Home.vue'),
    },
    {
      path: '/child1/:pathMatch(.*)',
      name: 'child1',
      component: () => import('../views/app1.vue'),
    },
    {
      path: '/child2/:pathMatch(.*)',
      name: 'child2',
      component: () => import('../views/app2.vue'),
    },
    {
      path: '/:catchAll(.*)*',
      name: 'error',
      meta: {
        name: '404',
      },
      component: () => import('../views/404.vue'),
    },
  ]
})

export default router